package com.ll.gulimall.serach.vo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ll.common.valid.AddGroup;
import com.ll.common.valid.ListVals;
import com.ll.common.valid.UpdataShowStatus;
import com.ll.common.valid.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * 品牌
 *
 * @author liliang
 * @email liliang@gmail.com
 * @date 2020-07-30 23:16:45
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @NotNull(message = "品牌Id不能为空", groups = {UpdateGroup.class,UpdataShowStatus.class})
    @Null(message = "新增不能有品牌Id", groups = {AddGroup.class})
    @TableId
    private Long brandId;
    /**
     * 品牌名
     */
    @NotEmpty(message = "品牌名称不能为空", groups = {AddGroup.class})
    private String name;
    /**
     * 品牌logo地址
     */
    @NotEmpty(message = "商品介绍不能为空", groups = {AddGroup.class})
    @URL(message = "请输入正确的路径", groups = {AddGroup.class})
    private String logo;
    /**
     * 介绍
     */
    @NotEmpty(message = "商品介绍不能为空", groups = {AddGroup.class})
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */
    @NotNull(message = "显示状态不能为空", groups = {AddGroup.class, UpdataShowStatus.class})
    @ListVals(vals={0,1},message="显示状态[0-不显示；1-显示]",groups = {AddGroup.class,UpdataShowStatus.class})
    private Integer showStatus;
    /**
     * 检索首字母
     */
    @NotEmpty(message = "显示状态不能为空", groups = {AddGroup.class})
    @Pattern(regexp = "^[a-zA-Z]$", message = "请输入a-Z的一个字母", groups = {UpdateGroup.class, AddGroup.class})
    private String firstLetter;
    /**
     * 排序
     */
    @NotNull(message = "排序不能为空", groups = {AddGroup.class})
    @Min(value = 0, message = "请输入大于等于0的数", groups = {UpdateGroup.class, AddGroup.class})
    private Integer sort;

}
